package service;

import java.util.List;

import bean.Goods;
import bean.GoodsRowMapper;
import common.BaseDAO;

public class ProductDAO extends BaseDAO {
	//根据goodsid查找商品信息
	public List<Goods> queryByGoodsid(int goodsid){
		String sql="select * from goods_info where goodsid=?";
		return this.query(sql, new GoodsRowMapper(), goodsid);
	}
	
	//根据tcid查找商品信息
	public List<Goods> queryByTcid(int tcid){
		String sql="select * from goods_info where third_categoryid=?";
		return this.query(sql, new GoodsRowMapper(), tcid);
	}
	
	//根据goodsid和num减去对应商品的库存数量
	public void updateCountByGoosidAndNum(int goodsid,int num){
		String sql="update goods_info set count=count-? where goodsid=?";
		this.update(sql, num,goodsid);
	}
}
